package com.jsh.erp.service.todoTask;

import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.depotHead.DepotHeadResource;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * @author YikWorld
 * @version 1.8
 * @Date: 2025/6/6 -> 16:01分
 * @description:
 */
@Service(value = "todoTask_component")
@TodoTaskResource
public class TodoTaskComponent implements ICommonQuery {

    @Resource
    private TodoTaskService todoTaskService;


    @Override
    public Object selectOne(Long id) throws Exception {
        return null;
    }
    @Override
    public List<?> select(Map<String, String> map) throws Exception {
        String search = map.get(Constants.SEARCH);
        String taskType = StringUtil.getInfo(search, "taskType");
        String status = StringUtil.getInfo(search, "status");
        Long creator = StringUtil.parseStrLong(StringUtil.getInfo(search, "creator"));
        return todoTaskService.select(QueryUtils.offset(map), QueryUtils.rows(map),taskType,status,creator);
    }

    @Override
    public Long counts(Map<String, String> map) throws Exception {
        String search = map.get(Constants.SEARCH);
        String taskType = StringUtil.getInfo(search, "taskType");
        String status = StringUtil.getInfo(search, "status");
        Long creator = StringUtil.parseStrLong(StringUtil.getInfo(search, "creator"));
        return todoTaskService.countTodoTask(taskType,status,creator);
    }

    @Override
    public int insert(JSONObject obj, HttpServletRequest request) throws Exception {
        return 0;
    }

    @Override
    public int update(JSONObject obj, HttpServletRequest request) throws Exception {
        return 0;
    }

    @Override
    public int delete(Long id, HttpServletRequest request) throws Exception {
        return 0;
    }

    @Override
    public int deleteBatch(String ids, HttpServletRequest request) throws Exception {
        return 0;
    }

    @Override
    public int checkIsNameExist(Long id, String name) throws Exception {
        return 0;
    }
}
